import createRoute from '../util/route'

export default class History {
  constructor(router) {
    this.router = router
    this.current = createRoute(null, '/')
    this.cb = null
  }
  listen(cb){
    this.cb = cb
  }
  transitionTo(path, onComplate) {
    this.current = this.router.matcher.match(path)
    // console.log("this.current====", this.current)
    this.cb&&this.cb(this.current)
    onComplate && onComplate()
  }
}